#pragma once

// Usage:
// ZENO_P(x) - print single variable or expression x to console in format("x={}", x)
// ZENO_B() - manual break point, will trap when running with debugger, crash if no debugger attached
// ZENO_A(x) - assert condition x is true, invokes ZENO_B() when x is false
// These macros have no effect when Zeno is built in Release mode, i.e. only work in Debug mode

#ifndef NDEBUG
#include <zenox/print.hpp>
#include <zenox/pragma.hpp>

#define ZENO_P(x) ::zenox::printnl(#x " = \x1b[33m", x, "\x1b[m\n");

#define ZENO_B() ZENO_DEBUG_BREAK();
#define ZENO_A(x) do { \
    if (ZENO_UNLIKELY(!(x))) { \
        ::zenox::printnl("assert failed: \x1b[31;1m" #x "\x1b[m\n"); \
        ZENO_DEBUG_BREAK(); \
    } \
} while (0)

#else

#define ZENO_P(x)
#define ZENO_PS(...)
#define ZENO_B()
#define ZENO_A(x)

#endif
